package com.niiwoo.civet.trade.dto.request;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

/**
 * 发布借款反欺诈请求参数
 *
 * @author xueyuke
 * @date 2017-11-23
 */
@Setter
@Getter
public class LoanAgainstFackRequestDTO implements Serializable {
    private static final long serialVersionUID = 4361448191958731868L;

    private String platformType;
    private String modelResult;
    private Long projectId;

    /**
     * 反欺诈结果枚举
     */
    public enum ModelResultEnum {
        PASS("0", "通过"),
        NO_PASS("1", "不通过"),
        NEED_AUDIT("2", "需要人工审核");
        private final String code;
        private final String desc;

        public String getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        ModelResultEnum(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }
    }

    @Override
    public String toString() {
        return "LoanAgainstFackRequestDTO{" +
                ", platformType='" + platformType +
                ", modelResult='" + modelResult +
                ", projectId='" + projectId + 
                '}';
    }

    public boolean isSuccess() {
        return this.modelResult.equals(ModelResultEnum.PASS.getCode())
                ||this.modelResult.equals(ModelResultEnum.NEED_AUDIT.getCode());
    }
}
